package org.itboys.mobile.dto.order;

import org.itboys.mobile.entity.mongo.OrderItem;
import org.itboys.mobile.entity.mysql.order.PearlOrder;

import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;

/**
 * Created by liu on 2017/11/1.
 */
public class OrderWaitDto {
    private Long orderId;   //订单id
    private String orderNo; //订单编号
    private String buyerName;//购买人
    private Date createTime;// 生成时间
    private BigDecimal expressFee ;// 物流费用金额
    private BigDecimal totalMoney;//实付金额
    private Double scale;
    private Integer status;// 订单状态 0：待付款，1：待发货，2：待收货，3：待评价， 4：交易完成，5：取消订单， 6：已退款
    private List<OrderItemDTO> list;

    public OrderWaitDto(PearlOrder order, List<OrderItem> itemList) {
        this.createTime = order.getCreatTime();
        this.expressFee = order.getFreight();
        this.totalMoney = order.getPayAmount();
        this.status = order.getOrderStatus();
        this.orderId = order.getId();
        this.orderNo = order.getOrderNo();
        List<OrderItemDTO> dtos = new ArrayList<>();
        for(OrderItem item : itemList) {
            OrderItemDTO dto = new OrderItemDTO(item);
            dtos.add(dto);
        }
        this.scale = Double.parseDouble(order.getScale());
        this.list = dtos;

    }

    public Long getOrderId() {
        return orderId;
    }

    public void setOrderId(Long orderId) {
        this.orderId = orderId;
    }

    public String getOrderNo() {
        return orderNo;
    }

    public void setOrderNo(String orderNo) {
        this.orderNo = orderNo;
    }

    public String getBuyerName() {
        return buyerName;
    }

    public void setBuyerName(String buyerName) {
        this.buyerName = buyerName;
    }

    public Date getCreateTime() {
        return createTime;
    }

    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
    }

    public BigDecimal getExpressFee() {
        return expressFee;
    }

    public void setExpressFee(BigDecimal expressFee) {
        this.expressFee = expressFee;
    }

    public BigDecimal getTotalMoney() {
        return totalMoney;
    }

    public void setTotalMoney(BigDecimal totalMoney) {
        this.totalMoney = totalMoney;
    }

    public Double getScale() {
        return scale;
    }

    public void setScale(Double scale) {
        this.scale = scale;
    }

    public Integer getStatus() {
        return status;
    }

    public void setStatus(Integer status) {
        this.status = status;
    }

    public List<OrderItemDTO> getList() {
        return list;
    }

    public void setList(List<OrderItemDTO> list) {
        this.list = list;
    }
}
